package com.wavehi.mapper;

import com.wavehi.pojo.User;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author WaveHi
 * @Date 18/10/2021 下午 3:38
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description Operate the database
 */
@Repository
public interface UserMapper {

    /**
     * Insert a data to database.
     * @param user User
     * @return If false is returned, insert fails.
     */
    Boolean insert(User user);

    /**
     * Insert multi data to database
     * @param users User information
     * @return If false is returned, insert fails.
     */
    Boolean batchInsert(List<Object[]> users);

    /**
     * Query data from database according to id
     * @param id The user id
     * @return Return an object that encapsulates the specified user information.
     */
    User selectById(Long id);

    /**
     * Query user name according to id
     * @param id User id
     * @return Return user name.
     */
    String selectByIdForUsername(Long id);

    /**
     * Query all the user information
     * @return Return a list that contains all the user information.
     */
    List<User> selectAll();
}
